package com.hadoop.mr2.multipleinput;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.MultipleInputs;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import com.hadoop.mr2.inputformat.ScoreDriver;
import com.hadoop.mr2.inputformat.ScoreInputFormat;
import com.hadoop.mr2.inputformat.ScoreMapper;

public class InputDriver {
	
	public static void main(String[] args) throws Exception {
		Configuration conf=new Configuration();
		Job job=Job.getInstance(conf);
		
		job.setJarByClass(InputDriver.class);
		
		
		job.setMapOutputKeyClass(Text.class);
		job.setMapOutputValueClass(Text.class);
		
		MultipleInputs.addInputPath(job,new Path("hdfs://192.168.234.231:9000/inputscore/input.txt"),
				ScoreInputFormat.class,InputMapper1.class);
		
		MultipleInputs.addInputPath(job, new Path("hdfs://192.168.234.231:9000/inputscore/part-r-00000"),
				TextInputFormat.class,InputMapper2.class);
		
		
		FileOutputFormat.setOutputPath(job, new Path("hdfs://192.168.234.231:9000/inputscore/result"));
		
		job.waitForCompletion(true);
	}

}
